package cn.jhc.bookstore.cn.jhc.bookstore.db;

import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;

public class UserDao {
    
    private static final String CREATE_USER = "create table if not exists users(" +
            "id int auto_increment primary key," +
            "email varchar(255) not null unique," +
            "password varchar(255) not null)";
    
    public static void createTable(QueryRunner runner) {
        try {
            runner.execute("drop table if exists users");
            runner.execute(CREATE_USER);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
    
    
}
